package shujujiegou.Duigui;
/*插入排序*/
public class InsertSort {


    public void insert(int[] a) {
        insertSort(a,1);
    }

    private void insertSort(int[] a, int low) {
        if (low == a.length) {
            return;
        }
        int t = a[low];
        int i = low - 1;
        while (i >= 0 && a[i] > t){
            a[i+1]=a[i];
            i--;
        }
        a[i+1]=t;
        insertSort(a,low+1);
    }
}
